package com.chat.service;

import com.chat.entity.Record;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface ChatService {
    public Long getId(String token);
    public List getMessages(String token);
    public List findUsers(String token,String username);
    /**
     * 新增聊天信息
     * @param id 用户id
     * @param message 信息
     * @Return  Boolean
     * {
     *     "_id" : ObjectId("6322cec338fe4241b3f0f0da"),
     *     "records" : [
     *         {
     *             username:"用户名",
     *             uid:1,
     *             record:[
     *              {
     *                  message:"",
     *                  me:true
     *              }
     *             ]
     *         }
     *     ],
     *     "id" : NumberInt(1),
     *     "_class" : "com.chat.entity.Chat"
     * }
     * */
    public Boolean addMessage(Long id,Long uid,String message,Boolean isMe);
    /**
     * 发送信息到个人
     *public Boolean sendMessage(Integer id,Integer uid,String message);
     * */
    public Boolean sendMessage(Long id,Long uid,String message);

    /**
     * 初始化用户聊天数据库
     * @param id 用户id
     * @Return Boolean
     * */
    public Boolean initUserRecord(Long id);

    /**
     * 设置消息状态
     * 0已读
     * 1未读
     * 2删除
     * */
    public Boolean setMessageState(Long id, Record record,Integer state);
}
